package com.lwm.mapper;

import com.lwm.domain.SalesOrder;
import com.lwm.dto.SalesOrderDto;
import org.apache.ibatis.annotations.*;
import org.junit.jupiter.api.Test;

import java.util.List;

@Mapper
public interface SalesOrderMapper {
    /**
     * 更具id获取
     *
     * @param id 编码
     * @return {@link SalesOrder}
     */
    @Select("select * from sales_order where id = #{id} and is_deleted = 0;")
    SalesOrder getById(Long id);

    /**
     * 收到分页
     *
     * @param salesOrderDto 销售订单dto
     * @return {@link List}<{@link SalesOrder}>
     */
    List<SalesOrder> getPage(SalesOrderDto salesOrderDto);

    /**
     * 获取全部
     *
     * @return {@link List}<{@link SalesOrder}>
     */
    @Select("select * from sales_order where is_deleted = 0 ;")
    List<SalesOrder> getAll();

    /**
     * 插入
     *
     * @param salesOrder 销售订单
     * @return {@link Integer}
     */
    Integer insert(SalesOrder salesOrder);

    /**
     * 更新
     *
     * @param salesOrder 销售订单
     * @return {@link Integer}
     */
    Integer update(SalesOrder salesOrder);

    /**
     * 删除一批
     *
     * @param ids ids
     * @return {@link Integer}
     */
    Integer removeBatch(List<Long> ids);

    /**
     * 获取总计
     *
     * @param salesOrderDto 销售订单dto
     * @return {@link Long}
     */
    Long getTotal(SalesOrderDto salesOrderDto);

}
